package vip.xiaonuo.modular.manage.tsdatarecord.controller;

import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import vip.xiaonuo.core.pojo.response.ResponseData;
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
import vip.xiaonuo.modular.manage.tsdatarecord.entity.BaseDataTable;
import vip.xiaonuo.modular.manage.tsdatarecord.param.DataParam;
import vip.xiaonuo.modular.manage.tsdatarecord.service.BaseDataTableService;

import javax.annotation.Resource;
import java.util.List;

/**
 * BaseDataTableController
 *
 * @author JackLee
 * 2022/8/10 11:40
 */
@RestController
public class BaseDataTableController {

    @Resource
    private BaseDataTableService baseDataTableService;

    @GetMapping("/baseDataTable/list")
    @BusinessLog(title = "数据表头_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(@RequestParam(name = "recordId") Long recordId) {
        return new SuccessResponseData(baseDataTableService.findListByRecordId(recordId));
    }

    @PostMapping("/baseDataTable/list/update")
    @BusinessLog(title = "更新表头", opType = LogAnnotionOpTypeEnum.UPDATE)
    public ResponseData updateList(@RequestBody List<BaseDataTable> dataTableList) {
        baseDataTableService.updateList(dataTableList);
        return new SuccessResponseData();
    }


}
